package com.ezonsport.android.ui;



import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;

import com.ezonsport.android.R;

public class SettingActivity extends PreferenceActivity implements OnPreferenceChangeListener{
	private static final String USER_SETTING = "user_setting";
	private static final String GOAL_SETTING = "goal_setting";
	private static final String PRIVACY_SETTING = "privacy_setting";
	private SharedPreferences m_sp;
	private Preference mUserSetting;
	//private Preference mGoalSetting;
	private Preference mPrivacySetting;
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.setting);
        mUserSetting = (Preference)findPreference(USER_SETTING);
        mUserSetting.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
			
			@Override
			public boolean onPreferenceClick(Preference preference) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(SettingActivity.this, UserInformationSettings.class);
				startActivity(intent);
				return false;
			}        
        });
        /*mGoalSetting = (Preference)findPreference(GOAL_SETTING);
        mGoalSetting.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
        	@Override
			public boolean onPreferenceClick(Preference preference) {
        		Intent intent = new Intent();
				intent.setClass(SettingActivity.this, GoalsSettings.class);
				startActivity(intent);
        		return false;
        	}
        }); */
        mPrivacySetting = (Preference)findPreference(PRIVACY_SETTING);
        mPrivacySetting.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
        	@Override
			public boolean onPreferenceClick(Preference preference) {
        		Intent intent = new Intent();
        		intent.setClass(SettingActivity.this, PrivacySettings.class);
        		startActivity(intent);
        		return false;
        		
        	}
        });
        
        
        m_sp = PreferenceManager.getDefaultSharedPreferences(this);
        m_sp.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener(){
        	@Override
        	public void onSharedPreferenceChanged (SharedPreferences sharedPreferences, String key){
        		
        	}
        });
    }
    
    public boolean onPreferenceChange(Preference preference, Object newValue){
    	return false;
    }
    
    
}
